home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / AclEntry.java < prev    next >
Text File  |  1998-09-22  |  5KB  |  142 lines

  1. /*
  2.  * @(#)AclEntry.java    1.9 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.security.acl;
  16.  
  17. import java.util.Enumeration;
  18. import java.security.Principal;
  19.  
  20. /**
  21.  * This is the interface used for representing one entry in an Access 
  22.  * Control List (ACL).<p>
  23.  * 
  24.  * An ACL can be thought of as a data structure with multiple ACL entry
  25.  * objects. Each ACL entry object contains a set of permissions associated 
  26.  * with a particular principal. (A principal represents an entity such as 
  27.  * an individual user or a group). Additionally, each ACL entry is specified
  28.  * as being either positive or negative. If positive, the permissions are 
  29.  * to be granted to the associated principal. If negative, the permissions 
  30.  * are to be denied. Each principal can have at most one positive ACL entry 
  31.  * and one negative entry; that is, multiple positive or negative ACL 
  32.  * entries are not allowed for any principal.
  33.  *
  34.  * Note: ACL entries are by default positive. An entry becomes a 
  35.  * negative entry only if the <a href = 
  36.  * "#setNegativePermissions">setNegativePermissions</a>
  37.  * method is called on it.
  38.  * 
  39.  * @see java.security.acl.Acl
  40.  *
  41.  * @author     Satish Dharmaraj
  42.  */
  43. public interface AclEntry extends Cloneable {
  44.  
  45.     /**
  46.      * Specifies the principal for which permissions are granted or denied 
  47.      * by this ACL entry. If a principal was already set for this ACL entry,
  48.      * false is returned, otherwise true is returned.
  49.      * 
  50.      * @param user the principal to be set for this entry.
  51.      * 
  52.      * @return true if the principal is set, false if there was 
  53.      * already a principal set for this entry.
  54.      */
  55.     public boolean setPrincipal(Principal user);
  56.  
  57.     /**
  58.      * Returns the principal for which permissions are granted or denied by 
  59.      * this ACL entry. Returns null if there is no principal set for this 
  60.      * entry yet. 
  61.      * 
  62.      * @return the principal associated with this entry.
  63.      */
  64.     public Principal getPrincipal();
  65.  
  66.     /**
  67.      * Sets this ACL entry to be a negative one. That is, the associated 
  68.      * principal (e.g., a user or a group) will be denied the permission set 
  69.      * specified in the entry.
  70.      * 
  71.      * Note: ACL entries are by default positive. An entry becomes a 
  72.      * negative entry only if this <code>setNegativePermissions</code> 
  73.      * method is called on it.
  74.      */
  75.     public void setNegativePermissions();
  76.  
  77.     /**
  78.      * Returns true if this is a negative ACL entry (one denying the 
  79.      * associated principal the set of permissions in the entry), false 
  80.      * otherwise.
  81.      * 
  82.      * @return true if this is a negative ACL entry, false if it's not.
  83.      */
  84.     public boolean isNegative();
  85.  
  86.     /**
  87.      * Adds the specified permission to this ACL entry. Note: An entry can 
  88.      * have multiple permissions. 
  89.      * 
  90.      * @param permission the permission to be associated with 
  91.      * the principal in this entry.
  92.      * 
  93.      * @return true if the permission was added, false if the 
  94.      * permission was already part of this entry's permission set.
  95.      */
  96.     public boolean addPermission(Permission permission);
  97.  
  98.     /**
  99.      * Removes the specified permission from this ACL entry.
  100.      *  
  101.      * @param permission the permission to be removed from this entry.
  102.      * 
  103.      * @return true if the permission is removed, false if the 
  104.      * permission was not part of this entry's permission set.
  105.      */
  106.     public boolean removePermission(Permission permission);
  107.  
  108.     /**
  109.      * Checks if the specified permission is part of the 
  110.      * permission set in this entry.
  111.      * 
  112.      * @param permission the permission to be checked for.
  113.      * 
  114.      * @return true if the permission is part of the        
  115.      * permission set in this entry, false otherwise. 
  116.      */
  117.     public boolean checkPermission(Permission permission);
  118.  
  119.     /**
  120.      * Returns an enumeration of the permissions in this ACL entry.
  121.      * 
  122.      * @return an enumeration of the permissions in this ACL entry.
  123.      */
  124.     public Enumeration permissions();
  125.  
  126.     /**
  127.      * Returns a string representation of the contents of this ACL entry.
  128.      * 
  129.      * @return a string representation of the contents.
  130.      */
  131.     public String toString();
  132.  
  133.     /**
  134.      * Clones this ACL entry.
  135.      * 
  136.      * @return a clone of this ACL entry.
  137.      */
  138.     public Object clone();
  139. }
  140.  
  141.  
  142.